package teacher.action;

import java.text.SimpleDateFormat;
import java.util.Date;

import teacher.bean.Award;
import teacher.bean.Flow;
import teacher.service.award;
import teacher.service.flow;

import com.opensymphony.xwork2.ActionSupport;

public class modifyAwa extends ActionSupport{
	private Award awa;
	private int awardId;
	
	public Award getAwa() {
		return awa;
	}

	public void setAwa(Award awa) {
		this.awa = awa;
	}

	public int getAwardId() {
		return awardId;
	}

	public void setAwardId(int awardId) {
		this.awardId = awardId;
	}

	public String execute(){
		
		awa=new award().selectAwardById(awardId);
//		流程管理部分
		Award a=new Award();
		a=new flow().selectAwardByName(this.getAwa().getName());
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Flow f=new Flow();
		f.setFruitId(a.getAwaId());
		f.setFruitKind(3);
		f.setDirDo(2);
		f.setDirTime(df.format(new Date()));
		f.setSubDo(2);
		f.setSubTime(df.format(new Date()));
		f.setTeaDo(3);
		f.setTeaTime(df.format(new Date()));
//		流程管理结束
		if(new flow().insertFlow(f)){
			return SUCCESS;
		}else{
			return SUCCESS;
		}
		
	} 

}